package service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

import vo.MemberVO;
import dao.MemberDAO;

public class MemberService {
	private MemberDAO dao;

	public MemberDAO getMemberDAO() {
		return dao;
	}

	public void setMemberDAO(MemberDAO dao) {
		this.dao = dao;
	}

	public String register(MemberVO mvo){
		System.out.println("check1");
		String check = null;
		String member_id = mvo.getMember_id();
		System.out.println(member_id);
		if(dao.SearchMemberId(member_id)!=null){
			check = "fail";
		}else{
			check = "success";
			System.out.println(mvo);
			dao.insert(mvo);
			
		}
		System.out.println(check);
		return check;
		
	}
	public MemberVO SearchMemberId(String member_id){
		return dao.SearchMemberId(member_id);
	}
	
	public MemberVO SearchMemberPassword(String password){
		return dao.SearchMemberPassword(password);
	}
	public String SearchMyMember_id(HashMap map){
		return dao.SearchMyMember_id(map);
	}
	public String SearchMyPassword(HashMap map){
		return dao.SearchMyMember_id(map);
	}
	
	public void ModifyMember(MemberVO mvo){
			dao.UpdateMember(mvo);
	}
	public void ModifyMemerType(HashMap map){
		dao.UpdateMemerberType(map);
	}
	public void DeleteMember(String member_id){
		dao.DeleteMember(member_id);
	}
	
	public int selectTotalCount(){
		return dao.getTotalCount();
	}
	
	public ArrayList<MemberVO> getList(int page){
		return (ArrayList<MemberVO>)dao.getMemberList(page);
		
	}
}
